export const PARAMS_ADMIN = [
     {
        type: "a-input",
        field: "keyword",
        title: "账户名称",
        value: "",
        props: {placeholder:"请输入账户名称"}
    },
    {
      type:'a-button',
      field:'search',
      props:{
          type:'primary',
          icon:"search"
      },
      children:['搜索'],
      emit: ['click'],
      emitPrefix: 'btn-search',
    },
    {
      type:'a-button',
      field:'reset',
      props:{
          type:'primary',
          icon:"setting"
      },
      children:['重置'],
      emit: ['click'],
      emitPrefix: 'btn-reset',
    },
]

export const FORM_SET_PWD_ADMIN = [
    {
        type: "a-input-password",
        field: "oldPassword",
        title: "原登录密码",
        value: "",
        props: { placeholder: "请输入原登录密码","auto-complete":"new-password"},
        validate: [
            { required: true, message: "请输入原登录密码", trigger: "blur" }
        ]
    },
    {
        type: "a-input-password",
        field: "newPassword",
        title: "新登录密码",
        value: "",
        props:{type:"password",disabled:false,placeholder:"登录密码格式：包含字母大小写及数字。且长度8位以上","auto-complete":"new-password"},
        validate: [
            { required: true, message: "请输入登录密码", trigger: "blur" },
            {
            validator: (rule, val, d) => {
                var pwdblank = /^\S*$/;
                var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>《》/?~！@#￥……&*（）——|{}【】‘；：”“'。，、？]");
                var regUpper = /[A-Z]/;
                var regLower = /[a-z]/;
                var regStr = /[0-9]/;
                var complex = 0;
                if (regLower.test(val)) {
                    ++complex;
                }
                if (regUpper.test(val)) {
                    ++complex;
                }
                if (regStr.test(val)) {
                    ++complex;
                }
                if(!pwdblank.test(val)){
                    d(true)
                }else if(pattern.test(val)){
                    d(true)
                }else if (complex < 3 || val.length < 8) {
                    d(true)
                }
                d()
            },message: "登录密码包含字母大小写及数字。且长度8位以上"
            }
        ]
    }
]

export const FORM_ADMIN = [
    {
        type: "a-input",
        field: "loginName",
        title: "登录账户",
        value: "",
        props: { placeholder: "请输入登录账户" },
        validate: [
            { required: true, message: "请输入登录账户", trigger: "blur" }
        ]
    },
    {
        type: "a-input-password",
        field: "password",
        title: "登录密码",
        value: "",
        props:{type:"password",disabled:false,placeholder:"登录密码格式：包含字母大小写及数字。且长度8位以上","auto-complete":"new-password"},
        validate: [
            { required: true, message: "请输入登录密码", trigger: "blur" },
            {
            validator: (rule, val, d) => {
                var pwdblank = /^\S*$/;
                var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>《》/?~！@#￥……&*（）——|{}【】‘；：”“'。，、？]");
                var regUpper = /[A-Z]/;
                var regLower = /[a-z]/;
                var regStr = /[0-9]/;
                var complex = 0;
                if (regLower.test(val)) {
                    ++complex;
                }
                if (regUpper.test(val)) {
                    ++complex;
                }
                if (regStr.test(val)) {
                    ++complex;
                }
                if(!pwdblank.test(val)){
                    d(true)
                }else if(pattern.test(val)){
                    d(true)
                }else if (complex < 3 || val.length < 8) {
                    d(true)
                }
                d()
            },message: "登录密码包含字母大小写及数字。且长度8位以上"
            }
        ]
    },
    
    {
        type: "a-input",
        field: "userName",
        title: "姓名",
        value: "",
        props: { placeholder: "请输入姓名" },
        validate: [
            { required: true, message: "请输入姓名", trigger: "blur" }
        ]
    },
     {
        type: "a-input",
        field: "contact",
        title: "联系方式",
         value: "",
        props: { type: "text",placeholder: "请输入联系方式",maxLength:11},
        validate: [
            { required: true, message: "请输入联系方式", trigger: "blur" },
            {
            validator: (rule, val, d) => {
                val && !/^1(3[0-9]|4[0-9]|5[0-9]|6[0-9]|7[0-9]|8[0-9]|9[0-9])\d{8}$/.test(val) ? d(true) : d();
            },
            message: "手机格式错误"
            }
        ]
    },
     {
        type: "select",
        field: "roleIds",
        title: "角色",
        value: '',
        options:[],
        props: { placeholder: "请选择角色（待搜索）",showSearch:true},//mode:"multiple",
        validate: [
            { required: true, message: "请选择角色", trigger: "change" }
        ]
    },
     {
        type: "radio",
        field: "status",
        title: "启/禁状态",
         value: 1,
        options:[{value:1,label:'启用'},{value:2,label:'禁用'}],
    },
    {
      type:"a-input",
      field:"remark",
      title:"备注",
      value: "",
      props: { type: "textarea" },
     
    }, 
]

export const ADMIN_COLUMNS = [
    {
        title: '登录账户',
        dataIndex: 'loginName'
    },
    {
        title: '管理员姓名',
        dataIndex: 'userName'
    },
    {
        title: '手机号',
        dataIndex: 'contact',
    },
    {
        title: '角色名称',
        dataIndex: 'role',
    },
    {
        title: '状态',
        dataIndex: 'status',
        scopedSlots: { customRender: 'status' }
    },
     {
         title: '备注',
          width: '250px',
        dataIndex: 'remark',
    },
    {
        title: '账号/角色共享',
        dataIndex: 'share',
        scopedSlots: { customRender: 'share' }
    },
     {
        title: '创建时间',
        dataIndex: 'createdTime',
    },
    {
        title: '操作',
        dataIndex: 'action',
        scopedSlots: { customRender: 'action' }
    }
]

export const ADMIN_SHARE = [
    {
        title: '账号',
        dataIndex: 'loginNamel'
    },
    {
        title: '姓名',
        dataIndex: 'userName'
    }
]

export const PARAMS_SMS = [
     {
        type: "a-input",
        field: "parkName",
        title: "园区名称",
        value: "",
        props: {placeholder:"请输入园区名称"}
    },
    {
        type: "a-input",
        field: "signName",
        title: "签名名称",
        value: "",
        props: {placeholder:"请输入签名名称"}
    },
    {
      type:'a-button',
      field:'search',
      props:{
          type:'primary',
          icon:"search"
      },
      children:['搜索'],
      emit: ['click'],
      emitPrefix: 'btn-search',
    },
    {
      type:'a-button',
      field:'reset',
      props:{
          type:'primary',
          icon:"setting"
      },
      children:['重置'],
      emit: ['click'],
      emitPrefix: 'btn-reset',
    },
   
]

export const FORM_SMS = [
    {
        type: "select",
        field: "parkId",
        title: "园区平台公司",
        value: "",
        options:[],
        props: { placeholder: "请选择园区平台公司" },
        validate: [
            { required: true, message: "请选择园区平台公司", trigger: "change" }
        ]
    },
    {
        type: "a-input",
        field: "appId",
        title: "APPID",
        value: "",
        props: { placeholder: "请输入APPID" },
        validate: [
            { required: true, message: "请输入APPID", trigger: "blur" }
        ]
    },
     {
        type: "a-input",
        field: "signName",
        title: "签名名称",
        value: "",
        props: { placeholder: "请输入签名名称"},
        validate: [
            { required: true, message: "请输入签名名称", trigger: "blur" },
        ]
    },
     {
        type: "a-input",
        field: "appName",
        title: "小程序名称",
        value: "",
        props: { placeholder: "请输入小程序名称"},
        validate: [
            { required: true, message: "请输入小程序名称", trigger: "blur" },
        ]
    },
     {
        type: "a-input",
        field: "tempName",
        title: "模板名称",
        value: "",
        props: { placeholder: "请输入模板名称"},
        validate: [
            { required: true, message: "请输入模板名称", trigger: "blur" },
        ]
    },
      {
        type: "select",
        field: "tempType",
        title: "模板类型",
        value: "",
        options:[{label:'短信通知',value:2},{label:'验证码',value:1}],
        props: { placeholder: "请选择模板类型" },
        validate: [
            { required: true, message: "请选择模板类型", trigger: "change" }
        ]
    },
    {
      type:"a-input",
      field:"tempContent",
      title:"模板内容",
      value: "",
      props: { type: "textarea",placeholder: "例如：尊敬的 ${name}，您的快递已飞奔在路上，将今天 ${time} 送达您的手里，请留意查收"},
     
    }, 
]

export const SMS_COLUMNS = [
    {
        title: '园区平台公司名称',
        dataIndex: 'parkName'
    },
    {
        title: '小程序名称',
        dataIndex: 'appName'
    },
    {
        title: 'APPID',
        dataIndex: 'appId',
    },
    {
        title: '签名名称',
        dataIndex: 'signName',
    },
    {
        title: '模板名称',
        dataIndex: 'tempName',
    },
     {
        title: '模板类型',
         dataIndex: 'tempType',
        customRender: (text, row, index) => {
            if (row.tempType === 1) {
                return '验证码'
            } else if (row.tempType === 2){
                return '短信通知'
            }
            return ''
        },
    },
      {
        title: '创建时间',
        dataIndex: 'createdTime',
    },
       {
        title: '状态',
        dataIndex: 'tempStatus',
        scopedSlots: { customRender: 'tempStatus' }
    },
    {
        title: '操作',
        dataIndex: 'action',
        width: '180px',
        scopedSlots: { customRender: 'action' }
    }
]

 export const OPTION_INLINE = {
    form: {layout: 'inline'},
    resetBtn: false,
    submitBtn: false
  }
  export const OPTION_BLOCK= {
    form: { layout: "vertical" },
    row:{gutter: 20},
    resetBtn: false,
    submitBtn: false
  }
 